/**
 * 
 */
package edu.rice.myxo.sim;

import java.util.ArrayList;
import java.util.List;

/**
 * @author frogy
 *
 */
public class Workers extends Thread{
	
	int s;
	int e;
	ArrayList<MyxoAgent> l;
	int id;
	
	public Workers(ArrayList<MyxoAgent> _l, int _s, int _e, int _id){
		l = _l;
		s = _s;
		e = _e;
		id = _id;
	}
	
	public void run(){
		for(int i = s; i < e; i++){
			l.get(i).step();
			if (((int) Global.currTime) % ((int) Global.outputDt) == 0) {
				if (i % 100 == 0) {
					Global.gos[id] += l.get(i).calculateLocalOrder();
				}
				Global.ocs[id] += l.get(i).oriecorr();
				Global.ovs[id] += l.get(i).orientationVariation();
			}
		}
	}
	
}
